package org.chen.wordwave.bean;

import android.util.Log;

import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.util.List;

public class TransDataSet {
    private String from;
    private String to;
    private List<TransResultBean> trans_result;

    public String getFrom() {
        return from;
    }

    public void setFrom(String from) {
        this.from = from;
    }

    public String getTo() {
        return to;
    }

    public void setTo(String to) {
        this.to = to;
    }

    public List<TransResultBean> getTrans_result() {
        return trans_result;
    }

    public void setTrans_result(List<TransResultBean> trans_result) {
        this.trans_result = trans_result;
    }

    public static class TransResultBean implements Serializable {

        private String src;
        private String dst;

        public String getSrc() {
            return src;
        }

        public void setSrc(String src) {
            this.src = src;
        }

        public String getDst() {
            dst = toURLDecoder(dst);
            return dst;
        }

        public void setDst(String dst) {
            this.dst = dst;
        }
    }

    public static String toURLDecoder(String paramString) {
        if (paramString == null || paramString.isEmpty()) {
            return "";
        }
        try {
            String url = new String(paramString.getBytes(), StandardCharsets.UTF_8);
            url = URLDecoder.decode(url, "UTF-8");
            return url;
        } catch (UnsupportedEncodingException e) {
            Log.e("TransDataSet",e.toString());
        }
        return "";
    }
}
